<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">











<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Build Force Tomcat Maven Plugin - Deployment</title>
    <style type="text/css" media="all">
      @import url("../css/maven-base.css");
      @import url("../css/maven-theme.css");
      @import url("../css/site.css");
    </style>
    <link rel="stylesheet" href="../css/print.css" type="text/css" media="print" />
          <meta name="author" content="Martin Todorov
carlspring@gmail.com" />
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
      </head>
  <body class="composite">
    <div id="banner">
                    <span id="bannerLeft">
    
            Build Force Tomcat Maven Plugin
    
            </span>
                    <div class="clear">
        <hr/>
      </div>
    </div>
    <div id="breadcrumbs">
          
  

  
    
  
  
    
            <div class="xleft">
        Last Published: 2009-11-22
                      </div>
            <div class="xright">      
  

  
    
  
  
    
  </div>
      <div class="clear">
        <hr/>
      </div>
    </div>
    <div id="leftColumn">
      <div id="navcolumn">
           
  

  
    
  
  
    
                   <h5>Overview</h5>
            <ul>
              
    <li class="none">
                    <a href="../index.html">Introduction</a>
          </li>
              
    <li class="none">
                    <a href="../usage.html">Usage</a>
          </li>
              
    <li class="none">
                    <a href="../apidocs/index.html">Javadoc</a>
          </li>
              
    <li class="none">
                    <a href="../faq.html">FAQ</a>
          </li>
          </ul>
              <h5>Goals</h5>
            <ul>
              
    <li class="none">
                    <a href="../plugin-info.html">Overview of Goals</a>
          </li>
              
    <li class="none">
                    <a href="../examples/management.html">Management Goals</a>
          </li>
              
    <li class="none">
              <strong>Deployment Goals</strong>
        </li>
          </ul>
              <h5>Project Documentation</h5>
            <ul>
              
                
              
      
            
      
            
      
            
      
            
      
            
      
              
        <li class="collapsed">
                    <a href="../project-info.html">Project Information</a>
                </li>
              
                
              
      
            
      
            
      
            
      
            
      
            
      
            
      
            
      
              
        <li class="collapsed">
                    <a href="../project-reports.html">Project Reports</a>
                </li>
          </ul>
                                                 
                        
                        
            <a href="../../../" title="Google Code" class="poweredBy">
                            <img alt="Google Code" src="../images/code_logo.png" />
            </a>
                                
                        
                        
            <a href="http://maven.apache.org/" title="Maven" class="poweredBy">
                            <img alt="Maven" src="http://maven.apache.org/images/logos/maven-feather.png" />
            </a>
                               
  

  
    
  
  
    
        </div>
    </div>
    <div id="bodyColumn">
      <div id="contentBox">
        <div class="section"><h2>Deployment</h2>
<p>The plugin provides the following deployment goals:</p>
<ul><li><a href="#Copy web resources (useful for integrating with IDE-s)">Copy web resources (useful for integrating with IDE-s)</a></li>
<li><a href="#Copy webapp resources">Copy webapp resources</a></li>
<li><a href="#Deploy jar(s)">Deploy jar(s)</a></li>
<li><a href="#Deploy war">Deploy war</a></li>
</ul>
<div class="section"><h3><a name="Copy_web_resources_useful_for_integrating_with_IDE-s">Copy web resources (useful for integrating with IDE-s)</a></h3>
<p>This goal will copy the project resources described below to ${tomcat.home}/webapps/${yourWebapp}. The purpose of this goal is to provide a quick and easy way to modify web resources in your IDE (for example CSS, JS, etc.) and then have it installed to your already deployed (and usually running) web application.</p>
<p>This goal can be integrated with Eclipse or IntelliJ Idea quite easily.</p>
<ul><li>Under Eclipse you will need to have M2E and enable Maven dependency management.</li>
<li>Under IntelliJ Idea (late 8.x and 9.x), by default, upon Maven project re-import, Idea invokes process-resources.</li>
</ul>
<p>This goal will not restart Tomcat.</p>
<p>Maven goal:</p>
<div class="source"><pre>mvn tomcat:copy-web-resources</pre>
</div>
<p>Plugin settings:</p>
<div class="source"><pre>&lt;project&gt;
    ...
    &lt;build&gt;
        ...
        &lt;plugins&gt;
            ...
            &lt;plugin&gt;
                &lt;groupId&gt;org.buildforce&lt;/groupId&gt;
                &lt;artifactId&gt;tomcat-plugin&lt;/artifactId&gt;
                &lt;version&gt;1.0.0&lt;/version&gt;

                &lt;configuration&gt;
                    &lt;tomcatConfiguration&gt;
                        &lt;tomcatHome&gt;${tomcat.home}&lt;/tomcatHome&gt;
                        &lt;webappName&gt;doc&lt;/webappName&gt;
                    &lt;/tomcatConfiguration&gt;
                &lt;/configuration&gt;

                &lt;executions&gt;
                    &lt;execution&gt;
                        &lt;!-- This execution will only copy the web resources without restarting Tomcat. --&gt;
                        &lt;id&gt;tomcat-copy-web-resources&lt;/id&gt;
                        &lt;!--
                        Uncomment this, if you would like to attach this execution to the process-resources phase:
                        &lt;phase&gt;process-resources&lt;/phase&gt;
                        --&gt;

                        &lt;goals&gt;
                            &lt;goal&gt;copy-web-resources&lt;/goal&gt;
                        &lt;/goals&gt;

                        &lt;configuration&gt;
                            &lt;resources&gt;
                                &lt;resource&gt;
                                    &lt;directory&gt;${basedir}/src/main/webapp&lt;/directory&gt;
                                    &lt;targetPath&gt;${tomcat.home}/webapps/doc&lt;/targetPath&gt;
                                    &lt;includes&gt;
                                        &lt;include&gt;**/webgui/**/**&lt;/include&gt;
                                    &lt;/includes&gt;
                                &lt;/resource&gt;
                            &lt;/resources&gt;
                        &lt;/configuration&gt;
                    &lt;/execution&gt;
                &lt;/executions&gt;
            &lt;/plugin&gt;
            ...
        &lt;/plugins&gt;
        ...
    &lt;/build&gt;
    ...
&lt;/project&gt;</pre>
</div>
</div>
<div class="section"><h3><a name="Copy_webapp_resources">Copy webapp resources</a></h3>
<p>This goal will copy the project resources described below to ${tomcat.home}/webapps/${yourWebapp}. The purpose of this goal is to provide a quick and easy way to modify a web and webapp resources (for example CSS, JS, WEB-INF/** etc.) in your IDE and then have them installed to your already deployed (and usually running) web application.</p>
<p>This goal will stop Tomcat, deploy the web resources and re-launch Tomcat.</p>
<p>Maven goals:</p>
<div class="source"><pre>mvn clean package tomcat:copy-webapp-resources</pre>
</div>
<p>Plugin settings:</p>
<div class="source"><pre>&lt;project&gt;
    ...
    &lt;build&gt;
        ...
        &lt;plugins&gt;
            ...
            &lt;plugin&gt;
                &lt;groupId&gt;org.buildforce&lt;/groupId&gt;
                &lt;artifactId&gt;tomcat-plugin&lt;/artifactId&gt;
                &lt;version&gt;1.0.0&lt;/version&gt;

                &lt;configuration&gt;
                    &lt;tomcatConfiguration&gt;
                        &lt;tomcatHome&gt;${tomcat.home}&lt;/tomcatHome&gt;
                        &lt;webappName&gt;doc&lt;/webappName&gt;
                    &lt;/tomcatConfiguration&gt;
                &lt;/configuration&gt;

                &lt;executions&gt;
                    &lt;execution&gt;
                        &lt;!-- This execution will copy the web resources and restart Tomcat. --&gt;
                        &lt;id&gt;tomcat-copy-webapp-resources&lt;/id&gt;
                        &lt;!--
                        Uncomment this, if you would like to attach this execution to the install phase:
                        &lt;phase&gt;install&lt;/phase&gt;
                        --&gt;

                        &lt;goals&gt;
                            &lt;goal&gt;copy-webapp-resources&lt;/goal&gt;
                        &lt;/goals&gt;

                        &lt;configuration&gt;
                            &lt;resources&gt;
                                &lt;resource&gt;
                                    &lt;directory&gt;${basedir}/src/main/webapp&lt;/directory&gt;
                                    &lt;targetPath&gt;${tomcat.home}/webapps/doc&lt;/targetPath&gt;
                                    &lt;includes&gt;
                                        &lt;include&gt;**/webgui/**/**&lt;/include&gt;
                                        &lt;include&gt;**/WEB-INF/**/**&lt;/include&gt;
                                    &lt;/includes&gt;
                                &lt;/resource&gt;
                            &lt;/resources&gt;
                        &lt;/configuration&gt;
                    &lt;/execution&gt;
                &lt;/executions&gt;
            &lt;/plugin&gt;
            ...
        &lt;/plugins&gt;
        ...
    &lt;/build&gt;
    ...
&lt;/project&gt;</pre>
</div>
</div>
<div class="section"><h3><a name="Deploy_jars">Deploy jar(s)</a></h3>
<p>Suppose you are working in a multi-module web app. Let's say you've made changes to just one of those modules. Instead of having to build the module, then the assembly which produces the WAR and then having to manually re-deploy it to Tomcat, you can use this goal. The goal should be invoked after mvn package and it will install the produced jar file to ${tomcat.home}/webapps/${youWebapp}/WEB-INF/lib (along with any additional resources you might like).</p>
<p>This goal will stop Tomcat, deploy the jar(s) and re-launch Tomcat.</p>
<p>NOTE: This excludes the *javadoc* artifacts.</p>
<p>Maven goals:</p>
<div class="source"><pre>mvn clean package tomcat:deploy-jars</pre>
</div>
<p>Plugin settings:</p>
<div class="source"><pre>&lt;project&gt;
    ...
    &lt;build&gt;
        ...
        &lt;plugins&gt;
            ...
            &lt;plugin&gt;
                &lt;groupId&gt;org.buildforce&lt;/groupId&gt;
                &lt;artifactId&gt;tomcat-plugin&lt;/artifactId&gt;
                &lt;version&gt;1.0.0&lt;/version&gt;

                &lt;configuration&gt;
                    &lt;tomcatConfiguration&gt;
                        &lt;tomcatHome&gt;${tomcat.home}&lt;/tomcatHome&gt;
                        &lt;webappName&gt;doc&lt;/webappName&gt;
                    &lt;/tomcatConfiguration&gt;
                &lt;/configuration&gt;

                &lt;executions&gt;
                    &lt;execution&gt;
                        &lt;id&gt;tomcat-deploy-jars&lt;/id&gt;
                        &lt;!--
                        Uncomment this, if you would like to attach this execution to the install phase:
                        &lt;phase&gt;install&lt;/phase&gt;
                        --&gt;

                        &lt;goals&gt;
                            &lt;goal&gt;deploy-jars&lt;/goal&gt;
                        &lt;/goals&gt;

                        &lt;!-- The following optional configuration is also supported: --&gt;
                        &lt;configuration&gt;
                            &lt;resources&gt;
                                &lt;resource&gt;
                                    &lt;directory&gt;${basedir}/src/main/webapp&lt;/directory&gt;
                                    &lt;targetPath&gt;${tomcat.home}/webapps/doc&lt;/targetPath&gt;
                                    &lt;includes&gt;
                                        &lt;include&gt;**/webgui/**/**&lt;/include&gt;
                                        &lt;include&gt;**/WEB-INF/**/**&lt;/include&gt;
                                    &lt;/includes&gt;
                                &lt;/resource&gt;
                            &lt;/resources&gt;
                        &lt;/configuration&gt;
                    &lt;/execution&gt;
                &lt;/executions&gt;
            &lt;/plugin&gt;
            ...
        &lt;/plugins&gt;
        ...
    &lt;/build&gt;
    ...
&lt;/project&gt;</pre>
</div>
</div>
<div class="section"><h3><a name="Deploy_war">Deploy war</a></h3>
<p>This goal will stop Tomcat, deploy the war and re-launch Tomcat.</p>
<p>Maven goals:</p>
<div class="source"><pre>mvn clean package tomcat:deploy-war</pre>
</div>
<p>Plugin settings:</p>
<div class="source"><pre>&lt;project&gt;
    ...
    &lt;build&gt;
        ...
        &lt;plugins&gt;
            ...
            &lt;plugin&gt;
                &lt;groupId&gt;org.buildforce&lt;/groupId&gt;
                &lt;artifactId&gt;tomcat-plugin&lt;/artifactId&gt;
                &lt;version&gt;1.0.0&lt;/version&gt;

                &lt;configuration&gt;
                    &lt;tomcatConfiguration&gt;
                        &lt;tomcatHome&gt;${tomcat.home}&lt;/tomcatHome&gt;
                        &lt;webappName&gt;doc&lt;/webappName&gt;
                    &lt;/tomcatConfiguration&gt;
                &lt;/configuration&gt;

                &lt;executions&gt;
                    &lt;execution&gt;
                        &lt;id&gt;tomcat-deploy-war&lt;/id&gt;
                        &lt;!--
                        Uncomment this, if you would like to attach this execution to the install phase:
                        &lt;phase&gt;install&lt;/phase&gt;
                        --&gt;

                        &lt;goals&gt;
                            &lt;goal&gt;deploy-war&lt;/goal&gt;
                        &lt;/goals&gt;
                    &lt;/execution&gt;
                &lt;/executions&gt;
            &lt;/plugin&gt;
            ...
        &lt;/plugins&gt;
        ...
    &lt;/build&gt;
    ...
&lt;/project&gt;</pre>
</div>
</div>
</div>

      </div>
    </div>
    <div class="clear">
      <hr/>
    </div>
    <div id="footer">
      <div class="xright">&#169;  
          2009
    
          
  

  
    
  
  
    
  </div>
      <div class="clear">
        <hr/>
      </div>
    </div>
  </body>
</html>
